import React, {Component} from 'react';
import {Image, StyleSheet, Text, View} from 'react-native';
import {Flex, WingBlank} from '@ant-design/react-native';

class VCard extends Component {
    constructor(props) {
        super(props);
    }
    render() {
        return (
            <WingBlank>
                <Flex style={styles.flex}>
                    <Flex>
                        <Image
                            style={styles.image}
                            source={{
                                uri: this.props.baseurl + '/Building/' + this.props.item.CompanyBuildingID + '/2/' + this.props.item.imgFileName,
                            }}
                        />
                    </Flex>
                    <Flex style={styles.itemtextview}>
                        <Flex style={styles.item}>
                            <Text numberOfLines={1} style={styles.lowername}>
                                {this.props.item.BuildingName}
                            </Text>
                        </Flex>
                        <Flex style={styles.item}>
                            <Text style={styles.text}>负一楼 C21</Text>
                        </Flex>
                        <Flex style={styles.item}>
                            <Image
                                style={{
                                    width: 10,
                                    height: 11,
                                    marginRight: 5,
                                }}
                                source={require('~/assets/shouye/dizhi_12x.png')}
                            />
                            <Text numberOfLines={1} style={styles.text}>
                                {this.props.item.CityName}
                            </Text>
                        </Flex>
                        <Flex style={{...styles.item, position: 'absolute', bottom: 0, left: 10}}>
                            <Text style={styles.biaoqian}>出售</Text>
                            <Text style={styles.money}>
                                价格:
                                <Text
                                    numberOfLines={1}
                                    style={{
                                        fontSize: 18,
                                        fontWeight: 'bold',
                                    }}>
                                    {(this.props.item.PriceSellMin / 10000).toFixed(1)}
                                    --
                                    {(this.props.item.PriceSellMax / 10000).toFixed(1)}
                                </Text>
                                万
                            </Text>
                        </Flex>
                    </Flex>
                </Flex>
            </WingBlank>
        );
    }
}

export default VCard;

const styles = StyleSheet.create({
    flex: {
        backgroundColor: 'white',
        height: 125,
        marginTop: 10,
        borderRadius: 5,
        padding: 10,
        width: '100%',
    },
    image: {
        width: 105,
        height: 105,
    },
    itemtextview: {
        width: '100%',
        height: '100%',
        paddingLeft: 10,
        paddingRight: 105,
        flexDirection: 'column',
    },
    item: {
        width: '100%',
    },
    lowername: {
        fontSize: 15,
        color: '#333333',
        fontWeight: 'bold',
        height: 30,
        lineHeight: 30,
        position: 'relative',
    },
    text: {
        fontSize: 12,
        color: '#666666',
        height: 25,
        lineHeight: 25,
    },

    biaoqian: {
        width: 40,
        height: 20,
        lineHeight: 20,
        fontSize: 10,
        borderRadius: 2,
        textAlign: 'center',
        overflow: 'hidden',
        backgroundColor: '#EB5A31',
        color: '#FFFFFF',
    },
    money: {
        marginLeft: 10,
        fontSize: 14,
        color: '#EB5A31',
    },
});
